package com.gg.haoqi.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.gg.haoqi.R;
import com.gg.haoqi.bean.YjsList;
import com.gg.haoqi.utils.ImageLoaderUtils;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by LW on 2015/11/10.
 */
public class YjsAdapter extends AppBaseAdapter<YjsList> {

    public YjsAdapter(List<YjsList> list, Context context) {
        super(list, context);
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = AppBaseAdapter.ViewHolder.get(context, convertView, parent, R.layout.item_yjs_list);

        ImageView iv = (ImageView) holder.findViewById(R.id.item_yjs_img);
        TextView joinnum = (TextView) holder.findViewById(R.id.item_yjs_joinnum);
        TextView title = (TextView) holder.findViewById(R.id.item_yjs_title);
        TextView description = (TextView) holder.findViewById(R.id.item_yjs_description);

        ImageLoader.getInstance().displayImage(list.get(position).getPost().getImage(), iv, ImageLoaderUtils.getDisplayImageLoader());
        joinnum.setText(list.get(position).getPost().getRecord_count()+"");
        title.setText(list.get(position).getPost().getTitle());
        description.setText(list.get(position).getPost().getDescription());
        return holder;
    }
}
